home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Sound / SndPlayDoubleBuffer / _headers / SoundStruct.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-15  |  2.4 KB  |  93 lines  |  [TEXT/CWIE]

  1. /*
  2. **    Apple Macintosh Developer Technical Support
  3. **
  4. **    Structure that contains all the needed information for playing a sound.
  5. **
  6. **    by Mark Cookson, Apple Developer Technical Support
  7. **
  8. **    File:    SoundStruct.h
  9. **
  10. **    Copyright ©1996 Apple Computer, Inc.
  11. **    All rights reserved.
  12. **
  13. **    You may incorporate this sample code into your applications without
  14. **    restriction, though the sample code has been provided "AS IS" and the
  15. **    responsibility for its operation is 100% yours.  However, what you are
  16. **    not permitted to do is to redistribute the source as "Apple Sample
  17. **    Code" after having made changes. If you're going to re-distribute the
  18. **    source, we require that you make it clear in the source that the code
  19. **    was descended from Apple Sample Code, but that you've made changes.
  20. */
  21.  
  22. #ifndef __SOUNDSTRUCT__
  23. #define __SOUNDSTRUCT__
  24.  
  25. #include <Files.h>
  26. #include <Sound.h>
  27.  
  28. struct sGlobals {
  29.     long        ggestaltSoundAttr,
  30.                 ggestaltStandardFileAttr,
  31.                 ggestaltTranslationAttr;
  32.     Boolean        gSupports16Bit,
  33.                 gSupportsSPDB;
  34. };
  35.  
  36. typedef struct sGlobals sGlobals;
  37. typedef sGlobals *sGlobalsPtr;
  38.  
  39. /*
  40.     This giant structure is in seperate file because it is trying to be
  41.     hidden from view.  In fact there are accessor functions for most values,
  42.     and you should use those accessors.  If you are using DBFF.h a SoundInfoPtr
  43.     is typedef'ed to just a Ptr so that you can't see any of these fields.
  44. */
  45. struct SoundInfo {
  46.     unsigned long            signature;
  47.     Str63                    theName;
  48.     SndDoubleBufferHeader2    doubleHeader;
  49.     SndChannelPtr            chan;
  50.     SndCallBackUPP            theSoundCallBackUPP;
  51.     sGlobals                globals;
  52.     Fixed                    rateForResume;
  53.     unsigned long            fileType;
  54.     long                    numBuffers,
  55.                             dataStart,
  56.                             bytesTotal,
  57.                             bytesCopied,
  58.                             currentBuffer,
  59.                             doubleBufferSize;
  60.     short                    bytesPerFrame,
  61.                             refNum,
  62.                             vRefNum,
  63.                             compFactor;
  64.     Boolean                    paused,
  65.                             playing,
  66.                             adjusting,
  67.                             soundDone,
  68.                             backwards,
  69.                             hasBeenAdjusted,
  70.                             needsMasking,
  71.                             stopping;
  72. };
  73.  
  74. typedef struct SoundInfo SoundInfo;
  75. typedef SoundInfo *SoundInfoPtr;
  76.  
  77. /*
  78.     This is used to carry useful information to our interrupt routines.
  79.     I wouldn't remove any fields from this structure.
  80. */
  81. struct myParamBlockRec {
  82.     ParamBlockRec            pb;
  83.     long                    myA5;
  84.     SndDoubleBufferPtr        theBuffer;
  85.     SoundInfoPtr            theSoundInfo;
  86.     Boolean                    pbInUse;
  87. };
  88.  
  89. typedef struct myParamBlockRec myParamBlockRec;
  90. typedef myParamBlockRec *myParmBlkPtr;
  91.  
  92. #endif
  93.